package com.shangxia.monomer.common.util;

import sun.misc.PostVMInitHook;

import java.util.Base64;

/**
 * @author zhouya38158
 * @Package com.shangxia.monomer.common.util
 * @date 2021/7/21 16:13
 */
public class EncodeUtil {

    public static void main(String[] args) {
        System.out.println(encodeBase64("你好"));
        System.out.println(decodeBase64(encodeBase64("你好")));
    }

    public static String encodeBase64(String input) {
        return Base64.getEncoder().encodeToString(input.getBytes());
    }

    public static String decodeBase64(String input) {
        return new String(Base64.getDecoder().decode(input.getBytes()));
    }
}
